<extend name="Base/common"/>
<block name="header">
{:hook('mobileTopNav',array('title'=>$meta_title))}
</block>

<block name="body">
  <div class="text-warning">
    您的订单已提交成功，请您完成支付。<br>
    成功付款后，<span class="text-danger">24小时</span>内将为您发货！
  </div>
  <form action="<gt name="data.total_amount" value="0">{:U('Pay/index')}<else/>{:U('Pay/quick')}</gt>" id="payment_{$data['id']}" method="post" data-ajax="false">
    <input type="hidden" name="order_id" value="{$data['id']}">
    <div class="order-preview">
      <span class="head"></span>
      <div class="main">
        <div class="detail">
          <a href="{:U('Order/detail', array('order_sn' => $data['order_sn']))}">
            <p>订单金额：{$data.total_price} 元</p>
            <p>运费总额：<gt name="data.delivery_fee" value="0">{$data.delivery_fee} 元<else/>免运费配送</gt></p>
            <eq name="data.payment.is_use_coupon" value="1">
              <p style="text-indent: 1em;">优惠券：<span class="pay-total">- {$data.payment.coupon_amount} 元</span></p>
            </eq>
            <eq name="data.payment.is_use_card" value="1">
              <p style="text-indent: 1em;">礼品卡：<span class="pay-total">- {$data.payment.card_amount} 元</span></p>
            </eq>
            <gt name="data.payment.score_amount" value="0">
              <p>积分抵扣：<span class="pay-total">- {$data.payment.score_amount} 元</span></p>
            </gt>
            <eq name="data.payment.is_use_finance" value="1">
              <p>账户余额：<span class="pay-total">- {$data.payment.finance_amount} 元</span></p>
            </eq>
            <gt name="data.total_amount" value="0">
            <p>还需付款：<span class="pay-total"><span class="text-danger">{$data.total_amount}</span> 元</span></p>
            </gt>
            <p>订单编号：{$data['order_sn']}</p>
            <p>配送区域：{$data.ship.ship_area}</p>
            <p>配送地址：{$data.ship.ship_address}</p>
            <notempty name='data.memo'>
            <volist name='data.memo' id='vo'>
            <p>备注（{$key}）：{$vo}</p>
            </volist>
            </notempty>
            <notempty name='data.invoice_des'>
            <p>
            发票信息：
              <volist name='data.invoice_des' id='vo'>
                {$vo}&nbsp
              </volist>
            </p>
            </notempty>
         <if condition="C('REAL_NAME') eq 1">
            <p>真实姓名：{$data.realname}</p>
            <p>身份证号：{$data.idcard}</p>
            </if>
          </a>
          <i class="icon icon-arrow-right"></i>
        </div>
        <eq name="data.total_amount" value="0">
        <!-- 当订单总金额为0时，使用快捷支付（帐户余额，礼券等支付方式） -->
          <div class="quick-finance-tip">
            余额支付：
            <span class="text-danger">
              <em class="yen">&yen;</em> 
              {$data.payment.finance_amount}</span> ，请完成支付验证
          </div>
          <div class="quick-pay">
            <div class="control-group">
              <div class="controls">
                <input type="tel" class="Z_mobile" name="mobile" value="{:session('user_auth.mobile')}" disabled="1"><span class="btn btn-randcode">限注册手机</span>
              </div>
            </div>
            <div class="control-group">
              <input type="text" name="verify" id="verify" maxlength="4" placeholder="图形验证码">
              <img class="verifyimg J_reload_verify" style="width: 86px; height: 30px; position: absolute; right: 10px; top:8px;" title="点击更换" src="{:U('User/verify')}">
            </div>
            <div class="control-group">
              <input type="tel" name="randcode" class="last Z_mobile_randcode" maxlength="6" placeholder="支付验证码">
              <a href="javascript:;" class="btn btn-primary btn-randcode Z_mobile_randcode_button" data-geturl="{:U('User/sendMobileCode')}">获取支付验证码</a>
            </div>
            <div class="control-action">
              <a href="javascript:order.quick_pay({$data['id']});" class="btn btn-positive btn-block">立即支付</a>
            </div>
          </div>
        <else/>
        <!-- 使用第三方支付叠加支付 -->
          <div class="pay">
            <div class="type">
              <p>支付方式：</p>
              <select name="payment_type" id="payment_type" class="Z_payment_type">
                <if condition="!is_weixin()">
                  <option value="alipaywap" <eq name="data.payment.payment_type" value="alipaywap">selected="selected"</eq>>支付宝支付</option>
                </if>
                <notempty name='weixin'>
                   <option value="wechatpay" <eq name="data.payment.payment_type" value="wechatpay">selected="selected"</eq>>微信支付</option>
                </notempty>
                <if condition="is_app()">
                  <option value="wechatpay" <eq name="data.payment_type" value="wechatpay">selected="selected"</eq>>微信支付</option>
                </if>
              </select>
            </div>
            <input type="hidden" name="order_id" value="{$data['id']}">
            <input type="hidden" name="total_amount" class="Z_total_amount" value="{$data['total_amount']}">
            <if condition="is_app()">
                <a href="javascript:order.payByApp({$data['id']},'payment_type');" class="btn btn-block btn-positive">立即支付</a>
            <else/>
                <button class="btn btn-block btn-positive">立即支付</button>
            </if>
            <!-- <notempty name='weixin'>
            <a href="{:U('Crowdfunding/detail', array('id' => $data['id']))}" class="btn btn-block btn-positive">我要众筹</a>
            </notempty> -->
          </div>
        </eq>
      </div>
      <span class="foot"></span>
    </div>
  </form>
</block>
<block name="script">
  <script type="text/javascript">
    var order;
    seajs.use(['order', 'user'], function(o, user){
      order = o;
      var total_price = '{$order_count.total_price}',
        total_delivery = '{$order_count.total_delivery}';
        o.init(total_price, total_delivery);
        <if condition="is_app()">
            o.AliPayReturn('{$data.id}');
        </if>
      var mobile_no = "{:session('user_auth.mobile')}";
      if(!$.is_mobile_number(mobile_no)){
        $.ui.confirm('您尚未绑定手机号码，去绑定？',function(){
          window.location.href = '{:U("Member/mobileBind")}';
        });
      }
      user.getRandCode('quickPay');
    });
  </script>
</block>